<template>
	<view class="align-center wraper">
		<slot></slot>
		<view class="align-center">
			<text v-if="isdisabled" class="code-before">{{time}}秒后重发</text>
			<text v-else @click="getCode" class="code-later">获取验证码</text>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			time: {
				type: Number,
				default: 60
			},
			isdisabled: {
				type: Boolean,
				default: false
			},
			data: {
				type: String,
				default: ''
			}
		},
		methods: {
			getCode() {
				this.$emit('getCode')
			}
		}
	}
</script>

<style scoped lang="scss">
	.wraper {
		height: 80rpx;

		input {
			line-height: 100%;
			margin-left: 16rpx;
		}

		view text {
			font-size: 28rpx;
			margin-right: 24rpx;
		}

		.code-before {
			color: #999999;
		}

		.code-later {
			color: #3961FA;
		}
	}
</style>
